package com.hishop.coupon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hishop.common.utils.PageUtils;
import com.hishop.coupon.dao.SkuFullReductionDao;
import com.hishop.coupon.entity.SkuFullReductionEntity;
import com.hishop.coupon.service.SkuFullReductionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service("skuFullReductionService")
public class SkuFullReductionServiceImpl extends ServiceImpl<SkuFullReductionDao, SkuFullReductionEntity> implements SkuFullReductionService {

    @Resource
    private SkuFullReductionDao skuFullReductionDao;

    @Override
    public PageUtils queryPage(String key, Page<SkuFullReductionEntity> page) {
        QueryWrapper<SkuFullReductionEntity> qw = new QueryWrapper<>();
        if (!key.equals("")) {
            qw.like("id", key)
                    .or().like("sku_id",key)
                    .or().like("full_price",key)
                    .or().like("reduce_price",key)
            ;
        }
        return new PageUtils(skuFullReductionDao.selectPage(page,qw));
    }
}